# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :inherit_thread_class.py
# @Time      :2025/7/5 20:21
# @Author    :aiyimu

import threading

class MyThread(threading.Thread):
    def __init__(self, num):
        threading.Thread.__init__(self)
        self.num = num
    def run(self):
        print(f"线程{self.num}开始")
        print(f"线程{self.num}执行任务中")
        print(f"线程{self.num}执行任务结束")

# 使用自定义线程类
threads = []
for i in range(3):
    t = MyThread(i)
    threads.append(t)
    t.start()

for t in threads:
    t.join()

print("所有线程执行完毕")